The invention relates to a method and to an apparatus for encoding or decoding audio or video frame data.
For broadcasting purposes a 4-stereo-channel MPEG audio encoder board has been designed. A requirement for such encoders is that they are able to operate with different encoding parameters. MPEG allows e.g. various sample frequencies and overall data rates.
A problem arises when during normal encoding operation one or more parameters change. This may happen when the current type of program changes, e.g. from pure speech or news to music.
Normally the audio frames are processed in an encoder in subsequent different stages, for example conversion to frequency coefficients in a first stage and bit allocation and quantisation in a further stage. In a path in parallel to the first stage the psychoacoustic masking is calculated. A video encoder includes the following stages: block difference stage, DCT (discrete cosine transform), quantisation and in the feedback loop inverse quantisation, inverse DCT, motion compensated interpolation the output of which is input to the block difference stage, wherein the output of the quantisation is possibly VLC (variable length coding) encoded and buffered before final output and the buffer filling level is used to control the quantisation in such a way that encoding artefacts are masked as far as possible. If the encoding parameters would generally change at a time instant where a certain audio frame has been processed in such first stage but not yet in such further stage, the data of this frame will become useless after having been processed in the further stage with the changed encoding parameters.
In order to avoid such problem a big table with the old encoding parameters and a big table with the new encoding parameters could be stored in the encoder for some time for each channel wherein the xe2x80x98depthxe2x80x99 of the tables would depend on the number of streams within the encoder and which would require repeated updating. All processing stages of the encoder would need to have access to both channel tables and would need to determine at which time to access which of the tables. In particular in a multichannel encoder in which different channels may change different encoding parameters at different times, the channels possibly being assigned to different microprocessors, this solution could easily produce errors. The tables would require more memory capacity than the solution described below.
It is one object of the invention to disclose a method for encoding or decoding audio or video frame data for which encoding or decoding parameters are required. It is a further object of the invention to disclose an apparatus which utilises the inventive method.
In the invention intermediately stored general parameter tables are not used. Instead, the encoding parameters required for a specific processing path are added to the input streams for the audio channels and become linked with the associated audio data and are stored in the various buffers together with its audio data, i.e. the corresponding encoding parameters are kept linked with the audio data to be encoded throughout the encoding processing in the different data streams and data paths. Preferably the original encoding parameters assigned to the processing paths become converted to a different format in order to minimise the required word length and/or to facilitate easy evaluation in the related processing stages.
Thereby each data stream can be processed with the correct parameter set without waiting for finishing encoding of the old data stream and for reset and loading of new parameters before starting encoding of a new data stream with new parameters.
The invention can also be used in audio or video decoders whith a corresponding inverse order of processing stages.
In principle, the inventive method is suited for encoding audio or video frame data for which encoding parameters are required, wherein the required encoding parameters become linked at the input of the processing with frames of said audio or video data to be encoded and throughout different stages in the encoding processing, and wherein in each of theses stages the corresponding encoding parameters linked with current frame data to be processed are regarded in order to allow switching of the encoding parameters for any frame thereby avoiding encoding of invalid output data without reset, or:
for decoding audio or video frame data for which decoding parameters are required, wherein the required decoding parameters become linked at the input of the processing with frames of said audio or video data to be decoded and throughout different stages in the decoding processing, and wherein in each of theses stages the corresponding decoding parameters linked with current frame data to be processed are regarded in order to allow switching of the decoding parameters for any frame thereby avoiding decoding of invalid output data without reset.
In principle the inventive apparatus is suited for encoding audio or video frame data for which encoding parameters are required, and includes:
means for linking the required encoding parameters with frames of said audio or video data, said linking means arranged near the input of the apparatus;
means for converting time domain samples into frequency domain coefficients, to the input of which means buffer means are assigned;
means for calculating masking properties from said time domain samples, to the input of which means buffer means are assigned;
means for performing bit allocation and quantisation of the coefficients under the control of the output of said masking calculating means, to the input of which bit allocation and quantisation means buffer means are assigned,
wherein in said conversion means, in said masking calculating means and in said bit allocation and quantisation means the corresponding encoding parameters linked with current frame data to be processed are regarded in order to allow switching of the encoding parameters for any frame thereby avoiding encoding of invalid output data without reset.